package com.orifine.sql.simple;

public class SimpleUpdateBuilder {
	private static final String AND = ") \nAND (";
	private static final String OR = ") \nOR (";
	
	private SimpleSql sql;
	
	public SimpleUpdateBuilder() {
		sql = new SimpleSql();
	}

	public SimpleUpdateBuilder update(String table) {
		sql.statementType = SimpleSql.StatementType.UPDATE;
		sql.tables.add(table);
		return this;
	}

	public SimpleUpdateBuilder set(String sets) {
		sql.sets.add(sets);
		return this;
	}
	
	public  SimpleUpdateBuilder join(String join) {
		sql.join.add(join);
		return this;
	}
	
	public String toString() {
		return sql.updateSQL();
	}
	
	public  SimpleUpdateBuilder where(String conditions) {
		sql.where.add(conditions);
		sql.lastList = sql.where;
		return this;
	}

	public  SimpleUpdateBuilder or() {
		sql.lastList.add(OR);
		return this;
	}

	public  SimpleUpdateBuilder and() {
		sql.lastList.add(AND);
		return this;
	}
}
